
<!--conf-->
<!-- footer-->
<!-- com-title-->
<head>
  <meta charset="UTF-8"/>
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  <meta http-equiv="X-UA-Compatible" content="ie=edge"/>
  <link href="../../../lib/weui/weui.css" rel="stylesheet"/>
  <link href="../../scss/main.css" rel="stylesheet"/>
  <link rel="stylesheet" href="http://at.alicdn.com/t/font_490682_sgb0yn4jcxzjjor.css"/>
  <script src="../../../lib/weui/weui.js"></script>
  <link type="image/x-icon" href="http://on5ngaon4.bkt.clouddn.com/Mountain_64px_1120233_easyicon.net.ico" rel="shortcut icon"/>
  <script src="http://www.jq22.com/jquery/jquery-2.1.1.js"></script>
  <title>校园易购</title>
</head>
<body>
  <div id="backup"><a href="index.html?true"><font class="iconfont icon-fanhui">   </font></a>
    <div><span>商品发布</span></div>
  </div>
  <div class="weui-cells">
    <div class="weui-cell">
      <div class="weui-cell__hd">
        <label class="weui-label">商品类别</label>
      </div>
      <div class="weui-cell__bd">
        <input name="goodlist" placeholder="二手易购" readonly="readonly" class="weui-input"/>
      </div>
    </div>
  </div>
  <div class="weui-cells__title">商品详情</div>
  <div class="weui-cells">
    <div class="weui-cell">
      <div class="weui-cell__bd">
        <textarea placeholder="商品售价" rows="1" class="weui-textarea"></textarea>
      </div>
    </div>
  </div>
  <div class="weui-cells">
    <div class="weui-cell">
      <div class="weui-cell__bd">
        <textarea placeholder="标题名称" rows="1" class="weui-textarea"></textarea>
      </div>
    </div>
  </div>
  <div class="weui-cells">
    <div class="weui-cell">
      <div class="weui-cell__bd">
        <textarea placeholder="请输入商品描述ヽ(^▽^)ノ✿" rows="6" class="weui-textarea"></textarea>
      </div>
    </div>
  </div>
  <div class="weui-cells__title">商品图片</div>
  <div id="uploader" class="weui-cells weui-cells_form">
    <div class="weui-cell">
      <div class="weui-uploader">
        <div class="weui-uploader__hd">
          <p class="weui-uploader__title">图片上传</p>
          <div class="weui-uploader__info"></div>
        </div>
        <div class="weui-uploader__bd">
          <ul id="uploaderFiles" class="weui-uploader__files"></ul>
        </div>
        <div class="weui-uploader__input-box">
          <input id="uploaderInput" type="file" accept="image/*" capture="camera" multiple="" class="weui-uploader__input"/>
        </div>
      </div>
    </div>
  </div>
  <div onclick="success()" class="weui-btn-area"><a class="weui-btn weui-btn_primary">提交    </a></div>
  <footer class="weui-footer">
    <div>
      <p><a href="../102.data/index.html" class="weui-footer__link">版本日志</a><a href="../101.message/index.html" class="weui-footer__link">留言反馈</a></p>
    </div>
    <div>
      <p class="ueui-footer__text">Copyright &copy; 2017 信息中心</p>
    </div>
  </footer>
  <script>
    function success(){
        weui.confirm('发布成功！',function(){
            window.location.href = "buylist.html";
        });
    }
    
  </script>
  <script>
    var uploadCount = 0;
    weui.uploader('#uploader', {
    url: 'http://localhost:8081',
    auto: true,
    type: 'file',
    fileVal: 'fileVal',
    compress: {
        width: 1600,
        height: 1600,
        quality: .8
    },
    onBeforeQueued: function(files) {
        // `this` 是轮询到的文件, `files` 是所有文件
    
        if(["image/jpg", "image/jpeg", "image/png", "image/gif"].indexOf(this.type) < 0){
            weui.alert('请上传图片');
            return false; // 阻止文件添加
        }
        if(this.size > 10 * 1024 * 1024){
            weui.alert('请上传不超过10M的图片');
            return false;
        }
        if (files.length > 5) { // 防止一下子选择过多文件
            weui.alert('最多只能上传5张图片，请重新选择');
            return false;
        }
        if (uploadCount + 1 > 5) {
            weui.alert('最多只能上传5张图片');
            return false;
        }
    
        ++uploadCount;
    
        // return true; // 阻止默认行为，不插入预览图的框架
    },
    onQueued: function(){
        console.log(this);
    
        // console.log(this.status); // 文件的状态：'ready', 'progress', 'success', 'fail'
        // console.log(this.base64); // 如果是base64上传，file.base64可以获得文件的base64
    
        // this.upload(); // 如果是手动上传，这里可以通过调用upload来实现；也可以用它来实现重传。
        // this.stop(); // 中断上传
    
        // return true; // 阻止默认行为，不显示预览图的图像
    },
    onBeforeSend: function(data, headers){
        console.log(this, data, headers);
        // $.extend(data, { test: 1 }); // 可以扩展此对象来控制上传参数
        // $.extend(headers, { Origin: 'http://127.0.0.1' }); // 可以扩展此对象来控制上传头部
    
        // return false; // 阻止文件上传
    },
    onProgress: function(procent){
        console.log(this, procent);
        // return true; // 阻止默认行为，不使用默认的进度显示
    },
    onSuccess: function (ret) {
        console.log(this, ret);
        // return true; // 阻止默认行为，不使用默认的成功态
    },
    onError: function(err){
        console.log(this, err);
        // return true; // 阻止默认行为，不使用默认的失败态
    }
    });
  </script>
  <script>
    function getErr__number(){
        weui.picker([
            { label: '二手易购'}, 
            { label: '优惠拼团'},
            { label: '技能小铺'}, 
            { label: '武院纪念品'}
        ],{
            onConfirm: function (result) {
                goodlist[0].value= result[0].label;
            }
        });
    }        
    
    
    window.onload=function(){
        goodlist = document.getElementsByName("goodlist");
    
        goodlist[0].onclick=getErr__number;
    
    }
  </script>
</body>